package com.wuad.platformwuad.util;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 日期时间工具类
 */
public class DateTimeUtils {

    /**
     * 时间戳转日期
     *
     * @param timestamp
     * @return
     */
    public static String timeStampToDate(Long timestamp) {
        Date date = new Date(timestamp);
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String formattedDate = sdf.format(date);
        return  formattedDate;
    }

    /**
     * 获取指定格式的日期数据
     *
     * @return
     */
    public static String getDate() {
//        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        String formattedDate = sdf.format(new Date());
        System.out.println(formattedDate);
        return formattedDate;
    }

    /**
     * 获取时间戳
     *
     * @param args
     */
    public static void main(String[] args) {
        long currentTimeMillis = System.currentTimeMillis();
        System.out.println(currentTimeMillis);
    }

}

